package chapter2;
import java.util.Arrays;
import java.util.Scanner;
public class Test1 {

	public static void main(String[] args) {
	Scanner in=new Scanner(System.in);
	String s1="";
	while (in.hasNextLine()) {
	String str=in.nextLine();
	int x=strtoint(str);
	switch (x) {
	case 1:{
		String n;
		n=in.nextLine();
		int a=Integer.parseInt(n);
	     for (int i = 1; i <=a-1; i++) {
			System.out.print(fib(i)+" ");
		}
	System.out.println(fib(a));
	}	
		break;
	case 2:{ 
		String s;
		s=in.nextLine();
		String []arr;
		arr=s.split(" ");
		int []num=new int[arr.length];
		for (int i = 0; i < num.length; i++) {
			num[i]=Integer.parseInt(arr[i]);
			
		}
		sort(num);   
		for (int i = 0; i < num.length; i++) {
			s1+=num[i]+" ";
		}
	}
	break;
	case 3:{
		String b=in.nextLine();
		String []arr1;
		arr1=s1.split(" ");
		System.out.println(search(b,arr1));
		
	   }
		break;
	case 4:{
		String h=in.nextLine();
		int n,i=0;
		n=Integer.parseInt(h);
		String []str2=new String[n];
		while (i<n) {
			str2[i]=in.nextLine();
			//System.out.println(str2[i].length());
			while(str2[i].length()<18){
				str2[i]=in.nextLine();
			}
			i++;
			
		}
		getBirthDate(str2);
	   
		
	}
	break;
	case 0 :System.out.println("exit");return;
	
	}
	
	}

	}


	

	





	




	private static void getBirthDate(String[] str2) {
		for (int i = 0; i < str2.length; i++) {
			System.out.println(str2[i].substring(6, 10)+"-"+str2[i].substring(10, 12)+"-"+str2[i].substring(12, 14));
		}
		
	}














	private static int  search(String b, String[] arr1) {
		// TODO Auto-generated method stub
		for (int i = 0; i < arr1.length; i++) {
			if(arr1[i].equals(b)){
				return i;
			}
		}
		return -1;
	}







	private static void sort(int []num) {
		// TODO Auto-generated method stub	
		
	    Arrays.sort(num);
		System.out.println(Arrays.toString(num));	
		
	}

	private static int fib(int a) {
		if(a==1||a==2){
			return 1;
		}
			
		else
		{
		 return fib(a-1)+fib(a-2);
		
		}
		
	}

	private static int strtoint(String str) {
		if(str.equals("fib")){
			return 1;
		   }
			else if(str.equals("sort")){
				return 2;
				
			}
			else if(str.equals("search")){
				return 3;
			}
			else if(str.equals("getBirthDate")){
				return 4;
			}
			else{
				return 0;
			}
		
		
	}

	
}

